package com.nijie.library.controller.sys;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nijie.library.POJO.Message;
import com.nijie.library.POJO.modelPOJO.Book;
import com.nijie.library.service.sys.SysBookSvc;

@Controller
@RequestMapping("book")
public class SysBookCtrl {
	@Autowired
	private SysBookSvc sysBookSvc;
	@RequestMapping("book")
	public String page(){
		return "views/sys/book";
	}
	/**
	 * 列表
	 * @param title
	 * @return
	 */
	@RequestMapping("getBook")
	@ResponseBody
	public List<Book> getTitle(Book Book,HttpSession session) {
		return sysBookSvc.get(Book);
	}
	
	/**
	 * 新增
	 * @param title
	 * @param session
	 * @return
	 */
	@RequestMapping("save")
	@ResponseBody
	public  Message<Book> save(Book book,HttpSession session) {
		Message<Book> message = new Message<Book>();
		message = sysBookSvc.save(book);
		return message;
	}
	/**
	 * 更新
	 * @param title
	 * @param session
	 * @return
	 */
	@RequestMapping("modify")
	@ResponseBody
	public  Message<Book> modify(Book Book,HttpSession session) {
		Message<Book> message = new Message<Book>();
		message =sysBookSvc.modify(Book);
		return message;
	}
	/**
	 * 删除
	 * @param ids
	 * @param status
	 * @return
	 */
	@RequestMapping("removeBook")
	@ResponseBody
	public  Message<Book> removeTitle(String ids, String status,HttpSession session) {
		Message<Book> message = new Message<Book>();
		message = sysBookSvc.modifyStatus(ids, status);
		return message;
	}
}
